import 'dart:convert';
import 'dart:io';

///color系列的uuid配置
class UUIDConfig{
  //单例
  static UUIDConfig? _instance;

  //数据通讯uuid信息
  String uuid_server = "";
  String  uuid_write_1= "";
  String  uuid_write_2= "";
  String  uuid_notify= "";

  //ota相关的uuid信息
  String  uuid_server_ota= "";
  String  uuid_write_ota= "";
  String  uuid_notify_ota= "";


  UUIDConfig._() {
    if(Platform.isIOS){
      uuid_server = "A950";
      uuid_write_1 = "A951";
      uuid_write_2 = "A952";
      uuid_notify = "A953";

      uuid_server_ota = "AE00";
      //uuid_server_ota = "";
      uuid_write_ota = "AE01";
      uuid_notify_ota = "AE02";
    }else{
      uuid_server = "0000A950-0000-1000-8000-00805F9B34FB";
      uuid_write_1 = "0000A951-0000-1000-8000-00805F9B34FB";
      uuid_write_2 = "0000A952-0000-1000-8000-00805F9B34FB";
      uuid_notify = "0000A953-0000-1000-8000-00805F9B34FB";

      uuid_server_ota = "0000ae00-0000-1000-8000-00805F9B34FB";
      //uuid_server_ota = "";
      uuid_write_ota = "0000ae01-0000-1000-8000-00805F9B34FB";
      uuid_notify_ota = "0000ae02-0000-1000-8000-00805F9B34FB";
    }
  }

  static UUIDConfig get instance {
    _instance ??= UUIDConfig._();
    return _instance!;
  }

  String getUUIDJson() {
    Map<String,String> map = {};
    map["uuid_server"] = uuid_server;
    map["uuid_write_1"] = uuid_write_1;
    map["uuid_write_2"] = uuid_write_2;
    map["uuid_notify"] = uuid_notify;
    map["uuid_server_ota"] = uuid_server_ota;
    map["uuid_write_ota"] = uuid_write_ota;
    map["uuid_notify_ota"] = uuid_notify_ota;
    //把集合转成json
    return json.encode(map);
  }
}